using System;
using System.Collections.Generic;
namespace Net35.Xrm.Sdk
{
	internal sealed class LinkDescriptor : Descriptor
	{
		private class LinkDescriptorComparer : IEqualityComparer<LinkDescriptor>
		{
			public bool Equals(LinkDescriptor x, LinkDescriptor y)
			{
				return (x == null && y == null) || (x != null && y != null && object.Equals(x.Source, y.Source) && object.Equals(x.Relationship, y.Relationship) && object.Equals(x.Target, y.Target));
			}
			public int GetHashCode(LinkDescriptor obj)
			{
				if (obj == null)
				{
					return 0;
				}
				return obj.Source.GetHashCode() ^ ((obj.Target != null) ? obj.Target.GetHashCode() : 0) ^ ((obj.Relationship != null) ? obj.Relationship.GetHashCode() : 0);
			}
		}
		internal static readonly IEqualityComparer<LinkDescriptor> EquivalenceComparer = new LinkDescriptor.LinkDescriptorComparer();
		public Entity Source
		{
			get;
			private set;
		}
		public Relationship Relationship
		{
			get;
			private set;
		}
		public Entity Target
		{
			get;
			private set;
		}
		public LinkDescriptor(Entity source, Relationship relationship, Entity target) : this(EntityStates.Unchanged, source, relationship, target)
		{
		}
		public LinkDescriptor(EntityStates state, Entity source, Relationship relationship, Entity target) : base(state)
		{
			this.Source = source;
			this.Relationship = relationship;
			this.Target = target;
		}
	}
}
